<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/vue@3.2.47/dist/vue.global.js"></script>
    <link rel="stylesheet" href="./goods.css">
    <title>vue商品页</title>
</head>


<body>
    <div class="main">
        <div class="title">刷怪笼</div>

        <div class="goods" v-for="item in goods">
            <div class="left"><img v-bind:src="item.image" alt=""></div>
            <div class="right" v-if="(item.totalNum-item.buyNum)>0">
                <span v-bind:[symble]="style[1]">{{item.description}}</span>
                <span>剩余 {{item.totalNum-item.buyNum}} 只</span>
                <div class="bottom">
                    <span v-bind:[symble]="style[2]">{{item.price}}</span>
                    <input type="text" v-model="item.buyNum">
                    <button class="buy">驯服</button>
                </div>
            </div>
        </div>

    </div>

</body>
<script>
    Vue.createApp({
        data: () => {
            return {
                goods: [
                    { image: "https://tse4-mm.cn.bing.net/th/id/OIP-C.dVJkHfgUH21uNafGxtu1IAHaHa?w=194&h=194&c=7&r=0&o=5&pid=1.7", name: "", description: "中分头背带裤，我叫ikun你记住!", price: "2.5$", totalNum: "100", buyNum: 0 },
                    { image: "https://tse3-mm.cn.bing.net/th/id/OIP-C.X133hdjv-9oWzZ-3jR9ngQHaHa?w=194&h=194&c=7&r=0&o=5&pid=1.7", name: "", description: "中分头背带裤，我叫ikun你记住!", price: "2.5$", totalNum: "100", buyNum: 0 },
                    { image: "https://tse2-mm.cn.bing.net/th/id/OIP-C.5wG-WARXCGIHfo4Qsn1R1QHaHa?w=194&h=194&c=7&r=0&o=5&pid=1.7", name: "", description: "中分头背带裤，我叫ikun你记住!", price: "2.5$", totalNum: "100", buyNum: 0 },
                ],
                style: ["name", "description", "price"],
                symble: "class",

            }
        },
    }).mount('.main')

</script>

</html>